﻿@page "/testpageaction"
@using Project.Constraints.Common.Attributes
@using System.Diagnostics.CodeAnalysis
@using Project.Constraints.PageHelper
@using Project.Constraints.UI
@attribute [PageInfo(Title = "PageAction测试", Icon = "fa fa-question-circle-o", ForceShowOnNavMenu = true, GroupId = "test")]
@implements IPageAction
<div style="display:flex;flex-direction:column;gap:5px;">
    @foreach (var item in contents)
    {
        <span @key="@item.Item1">@($"{item.Item1:yyyy-MM-dd HH:mm:ss}") => @item.Item2</span>
    }
</div>
@code {
    List<(DateTime, string)> contents = [];

    public Task OnShowAsync()
    {
        contents.Add((DateTime.Now, "PageShow"));
        return InvokeAsync(StateHasChanged);
    }

    public Task OnHiddenAsync()
    {
        contents.Add((DateTime.Now, "PageHidden"));
        return Task.CompletedTask;
    }
}
